@extends('admin::layouts.master')
@section('content')
    @component('components.tabs',['title' => "[" . $role -> title . ']' . "权限配置"])
        @slot('nav')
            <li class="nav-link nav-item"><a href="/admin/role" >角色列表</a>
            </li>
            <li class="active nav-link nav-item"><a href="#">权限管理</a></li>
        @endslot
        @slot('body')
            <form action="/admin/role/permission/{{$role->id}}" method="post">
                @csrf
                <div class="panel panel-border-color panel-border-color-primary">
                    @foreach($modules as $module)
                        <div class="panel panel-flat mt-6">
                            @foreach ($module['rules'] as $rule)
                                <div class="panel-heading mt-6">{{$rule['group']}}</div>
                                <div class="col-sm-6 mt-2">
                                    @foreach ($rule['permissions'] as $permission)
                                        <label class="checkbox-inline">
                                            <input type="checkbox" id="inlineCheckbox3" name="name[]"
                                                   {{$role->hasPermissionTo($permission['name']) ? 'checked' : ''}}
                                                   value="{{$permission['name']}}"> {{$permission['title']}}
                                        </label>
                                    @endforeach
                                </div>
                            @endforeach
                        </div>
                    @endforeach
                </div>
                <button type="submit" class="btn btn-success">提交</button>
            </form>
        @endslot
    @endcomponent
@endsection
